<extend name="Layout::designer"/>

<block name="content">
    <div class="layout-content">

        <div class="page-title">设计师管理</div>

        <div class="content-top">
            <ul class="top-nav">
                <li class="active"><span>修改信息</span></li>
            </ul>
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
        <!--content-main start-->
        <div class="container-fluid content-main">
            <div class="row">
                <div class="col-md-12">
                    <div id="tsk" class="ui-tips bg-info" style="display:none">
                        <span class="icon glyphicon glyphicon-info-sign"></span> <span
                            id="ts">提示信息提示信息提示信息提示信息提示信息提示信息。</span>
                    </div>

                    <form class="form-horizontal" onsubmit="return func()" action="{:U('Designer/doUpdate')}" method="post" enctype="multipart/form-data">
                        <input type="hidden" value="{$list['id']}" class="js-id" name="id"/>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">设计师</label>
                            <div class="col-sm-5">
                                <input type="text" value="{$list['name']}" class="form-control js-name" name="name"/>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">风格</label>
                            <div class="col-sm-5">
                                <select class="form-control js-style" name="style_id">
                                    <foreach name="styles" item="style">
                                        <option data-style="{$style.id}" value="{$style.id}">{$style.name}</option>
                                    </foreach>
                                </select>
                                <span class="help-block"></span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">设计理念</label>
                            <div class="col-sm-5">
                                <input type="text" class="form-control js-idea" value="{$list['idea']}" name="idea" maxlength="42" placeholder="最多42个字符"/>
                                <span class="help-block"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">照片</label>
                            <div class="col-sm-2">
                                <img src="__PUBLIC__/upload/{$list['pic']}"  width="120px" height="120px">
                                <input type="file" name="pic">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-8">
                                <button onclick="func()" style="margin-left: 90px;width: 150px" type="submit"
                                        class="btn btn-default">保存
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--content-main end-->
    </div>
    <script>
        $(function () {
            $('option[data-style={$list["style_id"]}]').attr("selected", true);
        })
        function func() {
            var name = $('.js-name').val();
            if (name == '') {
                $('#tsk').css('display', 'block');
                $('#ts').html("设计师不能为空");
                return false;
            }

            if (idea == '') {
                $('#tsk').css('display', 'block');
                $('#ts').html("设计理论不能为空");
                return false;
            }
            return true;


        }
    </script>
</block>
